-
Notifications
You must be signed in to change notification settings - Fork 370
--fatal-deprecation excludes obsolete Deprecations #2671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
jathak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch with this! --fatal-deprecation <version> should definitely not make deprecations that were obsolete as of <version> fatal.
However, I actually think it makes more sense to exclude all deprecations that are obsolete in the currently running version from --fatal-deprecation, even if they weren't yet obsolete in the <version> passed to the flag.
If for instance, --fatal-deprecation 1.91.0 was added to a user's config when 1.91.0 was the current version, it makes sense for the flag to continue to work without warnings in 1.92.0 when mixed-decls and type-function are obsoleted without the user having to bump the fatal version to 1.92.0, which would additionally make with-private fatal.
22d85c6 to
50d51ac
Compare
lib/src/deprecation.dart
Outdated
| /// Returns the set of all deprecations done in or before [version]. | ||
| static Set<Deprecation> forVersion(Version version) { | ||
| var range = VersionRange(max: version, includeMax: true); | ||
| static Set<Deprecation> forVersion(Version version, [Version? current]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comparison to the current version is not necessary here. This should just exclude any deprecation where obsoleteIn is non-null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
I admit I had to read your last paragraph 5 times before it finally sank in 😆 You are perfectly right. The tests are somewhat lacking, because I don't know how stub the obsoletion data or sass version numbers. (Edit: Sorry for all the |
e2037a6 to
206e0b6
Compare
206e0b6 to
0a4d0fc
Compare
jathak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you bump the minor versions of the packages and add changelog entries so we can release this fix? (see here for instructions)
| final version = Version.parse('1.79.0'); | ||
| final deprecations = Deprecation.forVersion(version); | ||
|
|
||
| expect( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just check that a couple of the currently obsolete deprecations are excluded here. We use deprecations.yaml in the language repo as a single-source of truth for the current list of deprecations and don't want to have to manually update the list anywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand. I added two regression tests now (so that I don't break the current functionality) and one test for the intended fix (excluding obsolete deprecations).
0a4d0fc to
6fa7456
Compare
Using `--fatal-deprecation 1.92.0` would emit: "Warning: mixed-decls deprecation is obsolete, so does not need to be made fatal". This commit avoids these warnings by excluding obsolete deprecations. See also sass#2647
6fa7456 to
44eb3fd
Compare
| @@ -1,3 +1,7 @@ | |||
| ## 16.0.2 | |||
|
|
|||
| * No user-visible changes. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure about this (whether this is the Dart API or the JS API or both and if they were affected or not).

Using
--fatal-deprecation 1.93.3causes unrelated warnings:I think it is because
Depdecation.forVersiondoes not filter out deprecations that have been marked asobsoleteIn.This is my attempt to solve it. I hope I don't have to sign the Google Individual Contributor License Agreement, because I don't use a Google Account (I see no way to sign the agreement without an account, though I'm fine with agreeing to its contents, although my code is just a single conditional and the obvious related test). Also, the newly added test passes, and the grinder linted my code (as far as I can tell), but I could not run the -x node tests for some reason.
If this is unacceptable feel free to close this PR. It was a nice exercise learning something about Dart! Thank you for your time.
PS: This project is so well maintained and I'm grateful to @nex3 who kept in in shape for years and put so much effort in documentation and figuring out a path to go forward with the SASS syntax as CSS evolves more and more. Thank you!
Related: #2647